﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="login" Then
	call login
else
	call index
end if
end Function



Function index
	dim page,rs,sql
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
	dim  rs2,sql2,Runtxt,classid,i,listid,pid
    		classid = Request("classid")
    		If classid = "" Then classid = 0
   		If Not IsNumeric(classid) Then classid = 0
    		classid = CLng(classid)
    		If classid < 0 Then classid = 0

    		listid = Request("listid")
    		If listid = "" Then listid = 0
   		If Not IsNumeric(listid) Then listid = 0
    		listid = CLng(listid)
    		If listid < 0 Then listid = 0

	Runtxt=qingtian.RunStr

	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "SELECT top 1 pid from qingtian_photo_down where listid="&listid&" order by pid desc"
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof) then
		pid=rs("pid")+1
	else
		pid=1
	end if
	Rs.close
	set rs=nothing	

%>
	<card title="添加新图片"><p align="left">

	图片标题：<br/>
	<input emptyok="true"  name="name<%=Runtxt%>"  value="" type="text"/><br/>
	图片地址：<br/>
	<input emptyok="true"  name="urls<%=Runtxt%>"  value="" type="text"/><br/>
	图片排序：<br/>
	<input emptyok="true"  name="pid<%=Runtxt%>"  value="<%=pid%>" type="text"/><br/>
	图片格式：<br/>
	<input emptyok="true"  name="ext<%=Runtxt%>"  value="JPG" type="text"/><br/>
	图片大小：<br/>
	<input emptyok="true"  name="size<%=Runtxt%>"  value="10 K" type="text"/><br/>

	<anchor>确定提交
    	<go href="addphotodown.asp?Action=login&amp;classid=<%=classid%>&amp;listid=<%=listid%>&amp;page=<%=page%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="urls" value="$(urls<%=Runtxt%>)"/>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="pid" value="$(pid<%=Runtxt%>)"/>
        <postfield name="ext" value="$(ext<%=Runtxt%>)"/>
        <postfield name="size" value="$(size<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>

-------------<br/>
<a href='photodown.asp?classid=<%=classid%>&amp;listid=<%=listid%>&amp;page=<%=page%>&amp;sid=<%=sid%>'>返回图片管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
End Function


Function login
	dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1

		dim rs,sql,errs,classid,fleg,Path,txtid,listid
    		classid = Request("classid")
    		If classid = "" Then classid = 0
   		If Not IsNumeric(classid) Then classid = 0
    		classid = CLng(classid)
    		If classid < 0 Then classid = 0

    		listid = Request("listid")
    		If listid = "" Then listid = 0
   		If Not IsNumeric(listid) Then listid = 0
    		listid = CLng(listid)
    		If listid < 0 Then listid = 0


		dim name,urls,pid,ext,isize
        name=Request.form("name")
        urls=Request.form("urls")
        pid=Request.form("pid")
        ext=Request.form("ext")
        isize=Request.form("size")

	if pid="" then pid=1
	if not isnumeric(pid) then pid=1
		errs=""

	if urls=""  then errs=errs&"图片地址不能为空<br/>"
	if pid=""  then errs=errs&"排序不能为空<br/>"
	if not isnumeric(pid) then errs=errs&"排序必须为数字<br/>"



	%>
	<card id="login" title="添加新图片" ontimer="photodown.asp?classid=<%=classid%>&amp;listid=<%=listid%>&amp;page=<%=page%>&amp;sid=<%=sid%>"><timer value="20"/>
		<p align="left">
	<%
	IF len(errs)=0 then

		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select *  FROM qingtian_photo_down"
		rs.open sql,conn,1,3
		rs.addnew()
				rs("listid")=listid
				rs("name")=name
				rs("urls")=urls
				rs("size")=isize
				rs("ext")=ext
				rs("pid")=pid
		rs.update()
		rs.Close
		Set rs = Nothing
		%>添加新图片成功!<br/><%

	else%>
		<%=errs%>
		<a href="addphotodown.asp?classid=<%=classid%>&amp;listid=<%=listid%>&amp;page=<%=page%>&amp;sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='photodown.asp?classid=<%=classid%>&amp;listid=<%=listid%>&amp;page=<%=page%>&amp;sid=<%=sid%>'>返回图片管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 


%>
